function CheckAll(me){
var index = me.name.indexOf('$');  
var prefix = me.name.substr(0,index); 
for(i=0; i<document.forms[0].length; i++){ 
    var o = document.forms[0][i]; 
    if (o.type == 'checkbox'){ 
        if (me.name != o.name){
            if (o.name.substring(0, prefix.length) == prefix){
                o.checked = !me.checked; 
                o.click();
            }
        }
    }
}
}

function ApplyStyle(me, checkedClass, uncheckedClass) { 
    var td = me.parentNode; 
    if (td == null) 
    return; 
    var tr = td.parentNode;
    if (me.checked){ 
        tr.className = checkedClass;}
    else { 
        tr.className = uncheckedClass;
    }
    if(me.type == "radio")
    {
        objRadios = document.getElementsByName(me.name);
        for(x=0;x<objRadios.length;x++)
        {
            obj = objRadios[x];
            if(!obj.checked)
            {
                td = obj.parentNode; 
                if (td != null) 
                {
                    tr = td.parentNode;                 
                    if(tr.className == checkedClass)
                    {
                        obj.onclick();
                        break;
                    }  
                }
            }
        }
    }    
}